package com.tudouji.project.d3.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.d3.domain.D3Aftersales;
import com.tudouji.project.d3.service.ID3AftersalesService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 电商平台售后Controller
 * 
 * @author tudouji
 * @date 2023-08-21
 */
@RestController
@RequestMapping("/aftersales/aftersales")
public class D3AftersalesController extends BaseController
{
    @Autowired
    private ID3AftersalesService d3AftersalesService;

    /**
     * 查询电商平台售后列表
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:list')")
    @GetMapping("/list")
    public TableDataInfo list(D3Aftersales d3Aftersales)
    {
        startPage();
        List<D3Aftersales> list = d3AftersalesService.selectD3AftersalesList(d3Aftersales);
        return getDataTable(list);
    }

    /**
     * 导出电商平台售后列表
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:export')")
    @Log(title = "电商平台售后", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(D3Aftersales d3Aftersales)
    {
        List<D3Aftersales> list = d3AftersalesService.selectD3AftersalesList(d3Aftersales);
        ExcelUtil<D3Aftersales> util = new ExcelUtil<D3Aftersales>(D3Aftersales.class);
        return util.exportExcel(list, "aftersales");
    }

    /**
     * 获取电商平台售后详细信息
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(d3AftersalesService.selectD3AftersalesById(id));
    }

    /**
     * 新增电商平台售后
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:add')")
    @Log(title = "电商平台售后", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody D3Aftersales d3Aftersales)
    {
        return toAjax(d3AftersalesService.insertD3Aftersales(d3Aftersales));
    }

    /**
     * 修改电商平台售后
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:edit')")
    @Log(title = "电商平台售后", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody D3Aftersales d3Aftersales)
    {
        return toAjax(d3AftersalesService.updateD3Aftersales(d3Aftersales));
    }

    /**
     * 删除电商平台售后
     */
    @PreAuthorize("@ss.hasPermi('aftersales:aftersales:remove')")
    @Log(title = "电商平台售后", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(d3AftersalesService.deleteD3AftersalesByIds(ids));
    }
}
